﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMDev.BNET.ClientAPI
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
    public sealed class BNETApiMethodAttribute
        : Attribute
    {
        #region Properties

        public String Context
        {
            get;
            set;
        }

        public String Function
        {
            get;
            set;
        }

        public String ParametersFormat
        {
            get;
            set;
        }

        #endregion

        #region .ctor

        public BNETApiMethodAttribute()
        {            
        }

        #endregion

        #region Methods

        public override string ToString()
        {
            StringBuilder methodBuilder = null;

            methodBuilder = new StringBuilder();
            if (!String.IsNullOrWhiteSpace(this.Context))
            {
                methodBuilder.Append("/");
                methodBuilder.Append(this.Context);
                methodBuilder.Append("/");
            }
            methodBuilder.Append(this.Function);
            if (!String.IsNullOrWhiteSpace(this.ParametersFormat))
                methodBuilder.Append(this.ParametersFormat);

            return methodBuilder.ToString();
        }

        #endregion
    }
}
